<?php defined('RUN_KATANA') or die('Restricted access'); ?>
<?php 
$shop->loadOrders();
if($shop->Orders)
{
	foreach($shop->Orders as $order)
	{
		if(($order->getDeliveryStatus() == $_GET['status']) || ($_GET['status'] == ''))
		{
			echo '<tr class="items">';
			echo '<td class="first center">'.$order->getId().'<input type="hidden" name="o_id[]" value="'.$order->getId().'" /></td>';
			?>
				<td>&nbsp;
					<?php 
					if(file_exists(ORDERS_PATH.'order_'.$order->getId().'_confirmation.html'))
					{
						?>
						<a target="_blank" href="<?php echo ORDERS_URL.'order_'.$order->getId().'_confirmation.html' ?>"><img title="<?php echo ucfirst($txt->getWord('view')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>view_16.gif" /></a>
						<?php 
					}
					?>&nbsp;
				</td>
				<td><?php echo substr($order->getDateOrdered(), 0, 10); ?></td>
				<td><?php echo substr($order->getDateDelivery(), 0, 10); ?></td>
				<td><?php echo $order->getPaymentTitle(); ?></td>
				<td>
					<div style="display:none;"><?php echo $order->getPaymentStatus(); ?></div>
					<?php if($txt->getWordExplicit('payment_'.$order->getPaymentId().'_status_'.$order->getPaymentStatus()) != ''): ?>
						<img title="<?php echo $txt->getWordExplicit('payment_'.$order->getPaymentId().'_status_'.$order->getPaymentStatus()); ?>" class="icon" src="<?php echo SYSICONS_URL; ?>orders/payment_<?php echo $order->getPaymentId(); ?>_status_<?php echo $order->getPaymentStatus(); ?>_16.gif"  />
					<?php endif; ?>
					<select class="small" name="o_payment_status[]" disabled="disabled">
						<?php if($txt->getWordExplicit('payment_'.$order->getPaymentId().'_status_0') != ''): ?>
							<option value="0" <?php echo getIsSelectedHTML($order->getPaymentStatus(), 0); ?>><?php echo ucfirst($txt->getWord('payment_'.$order->getPaymentId().'_status_0')); ?></option>
						<?php endif; ?>
						<?php if($txt->getWordExplicit('payment_'.$order->getPaymentId().'_status_1') != ''): ?>
							<option value="1" <?php echo getIsSelectedHTML($order->getPaymentStatus(), 1); ?>><?php echo ucfirst($txt->getWord('payment_'.$order->getPaymentId().'_status_1')); ?></option>
						<?php endif; ?>
						<?php if($txt->getWordExplicit('payment_'.$order->getPaymentId().'_status_2') != ''): ?>
							<option value="2" <?php echo getIsSelectedHTML($order->getPaymentStatus(), 2); ?>><?php echo ucfirst($txt->getWord('payment_'.$order->getPaymentId().'_status_2')); ?></option>
						<?php endif; ?>
						<?php if($txt->getWordExplicit('payment_'.$order->getPaymentId().'_status_3') != ''): ?>
							<option value="3" <?php echo getIsSelectedHTML($order->getPaymentStatus(), 3); ?>><?php echo ucfirst($txt->getWord('payment_'.$order->getPaymentId().'_status_3')); ?></option>
						<?php endif; ?>
					</select>
				</td>
				<td><?php echo $order->getShippingTitle(); ?></td>
				<td>
					<?php 
					if($order->getShippingZoneCode() != '')
					{ echo $order->getShippingZoneCode(); }
					else
					{ echo $order->getDeliveryZip(4).' ('.$order->getDeliveryCity().')'; }
					?>
				</td>
				<?php /*
				<td>
					<select class="small-m" name="o_shipping_status_<?php echo $order->getId(); ?>" onchange="submit();" disabled="disabled">
						<?php if ($order->getShippingStatus() < 1): ?>
						<option value="0" <?php echo getIsSelectedHTML($order->getShippingStatus(), 0); ?>>
						<?php 
							if($txt->getWordExplicit('shipping_'.$order->getShippingID().'_status_0') != '')
							{ echo ucfirst($txt->getWordExplicit('shipping_'.$order->getShippingID().'_status_0')); }
							else
							{ echo ucfirst($txt->getWord('shipping_0_status_0')); }
						?>
						</option>
						<?php endif; ?>
						<?php if ($order->getShippingStatus() < 2): ?>
						<option value="1" <?php echo getIsSelectedHTML($order->getShippingStatus(), 1); ?>>
							<?php 
								if($txt->getWordExplicit('shipping_'.$order->getShippingID().'_status_1') != '')
								{ echo ucfirst($txt->getWordExplicit('shipping_'.$order->getShippingID().'_status_1')); }
								else
								{ echo ucfirst($txt->getWord('shipping_0_status_1')); }
							?>
						</option>
						<?php endif; ?>
						<?php if ($order->getShippingStatus() < 3): ?>
						<option value="2" <?php echo getIsSelectedHTML($order->getShippingStatus(), 2); ?>>
							<?php 
								if($txt->getWordExplicit('shipping_'.$order->getShippingID().'_status_2') != '')
								{ echo ucfirst($txt->getWordExplicit('shipping_'.$order->getShippingID().'_status_2')); }
								else
								{ echo ucfirst($txt->getWord('shipping_0_status_2')); }
							?>
						</option>
						<?php endif; ?>
						<?php if($txt->getWordExplicit('shipping_'.$order->getShippingID().'_status_3') != ''):  ?>
						<option value="3" <?php echo getIsSelectedHTML($order->getPaymentStatus, 3); ?>>
							<?php echo ucfirst($txt->getWordExplicit('shipping_'.$order->getShippingID().'_status_3')); ?>
						</option
						><?php endif; ?>
					</select>
				</td>
				*/ ?>
				<td valign="bottom">
					<div style="display:none;"><?php echo $order->getDeliveryStatus(); ?></div>
					<img title="<?php echo $txt->getWordExplicit('delivery_'.$order->getPaymentId().'_status_'.$order->getDeliveryStatus()); ?>" class="icon" src="<?php echo SYSICONS_URL; ?>orders/delivery_status_<?php echo $order->getDeliveryStatus(); ?>_16.gif"  />
					<select class="small-m" name="o_delivery_status_<?php echo $order->getId(); ?>" onchange="submit();" <?php if ($order->getDeliveryStatus() > 1) { echo 'disabled="disabled"';} ?> >
						<?php if ($order->getDeliveryStatus() < 1): ?>
						<option value="0" <?php echo getIsSelectedHTML($order->getDeliveryStatus(), 0); ?>>
							<?php if (($order->getDoubleConfirm() > 0) && ($order->getDoubleConfirmed() == 0)): ?>
								<?php echo ucfirst($txt->getWord('pending')); ?>:&nbsp;<?php echo $order->getShippingZoneTitle(); ?>&nbsp;-&nbsp; 
							<?php endif; ?>
							<?php if ($order->getDoubleConfirmed() > 0): ?>
								<?php echo ucfirst($txt->getWord('confirmed')); ?>:&nbsp;<?php echo $order->getShippingZoneTitle(); ?>&nbsp;-&nbsp; 
							<?php endif; ?>
							<?php echo ucfirst($txt->getWord('delivery_status_0')); ?>
						</option>
						<?php endif; ?>
						<?php if (($order->getDoubleConfirm() == 0) || ($order->getDoubleConfirmed() == 1)): ?>
							<?php if ($order->getDeliveryStatus() < 2): ?>
							<option value="1" <?php echo getIsSelectedHTML($order->getDeliveryStatus(), 1); ?>><?php echo ucfirst($txt->getWord('delivery_status_1')); ?></option>
							<?php endif; ?>
							<?php if ($order->getDeliveryStatus() < 3): ?>
							<option value="2" <?php echo getIsSelectedHTML($order->getDeliveryStatus(), 2); ?>><?php echo ucfirst($txt->getWord('delivery_status_2')); ?></option>
							<?php endif; ?>
						<?php endif; ?>
					</select>
				</td>
				<!--<td>
					<a href="<?php echo $commander->getFormAction(); ?>&order=<?php echo $order->getId(); ?>"><img title="<?php echo ucfirst($txt->getWord('edit')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>configure_16.gif" onclick="edit_form.submit();"  /></a>
				</td>-->
				<?php if($shop->getGlobalSetting('order_export_xml')): ?>
				<td>
					<?php if(is_file(ORDERS_PATH.'export/complete/order_'.$order->getId().'.xml')): ?>
					<a href="<?php echo ORDERS_URL.'export/complete/order_'.$order->getId().'.xml' ?>" target="_blank">
					<img title="<?php echo ucfirst($txt->getWord('complete')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>orders/delivery_status_2_16.gif" />&nbsp;
					<a href="<?php echo ORDERS_URL.'export/complete/order_'.$order->getId().'.xml' ?>" target="_blank">
					<img title="<?php echo ucfirst($txt->getWord('complete')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>csv_16.png" />
					</a>
					<?php else: ?>
						<?php if(is_file(ORDERS_PATH.'export/recived/order_'.$order->getId().'.xml')): ?>
						<img name="<?php echo ucfirst($txt->getWord('imported')); ?>" title="<?php echo ucfirst($txt->getWord('imported')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>orders/delivery_status_1_16.gif" />&nbsp;
						<a href="<?php echo ORDERS_URL.'export/recived/order_'.$order->getId().'.xml' ?>" target="_blank"><img name="<?php echo ucfirst($txt->getWord('imported')); ?>" title="<?php echo ucfirst($txt->getWord('imported')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>csv_16.png" /></a>
						<?php else: ?>
							<?php if(is_file(ORDERS_PATH.'export/new/order_'.$order->getId().'.xml')): ?>
							<img title="<?php echo ucfirst($txt->getWord('exported')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>orders/delivery_status_0_16.gif" />&nbsp;
							<a href="<?php echo ORDERS_URL.'export/recived/order_'.$order->getId().'.xml' ?>" target="_blank">
							<img title="<?php echo ucfirst($txt->getWord('exported')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>csv_16.png" /></a>
							<?php else: ?>
							<a onmousedown="$('#export_order_id').val(<?php echo $order->getId(); ?>);" onmouseup="$('#edit_form').submit();"><img title="<?php echo ucfirst($txt->getWord('export')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>export_16.png" /></a>
							<?php endif; ?>
						<?php endif; ?>
					<?php endif; ?>
				</td>
				<?php endif; ?>
				<td class="last">
				<?php if($order->getIsDeletable()): ?>
					<img title="<?php echo ucfirst($txt->getWord('delete')); ?>" class="icon command delete_o" src="<?php echo SYSICONS_URL; ?>delete_16.gif" onclick="deleteDialog(<?php echo $order->getId(); ?>);" />
				<?php endif; ?>
				</td>
			</tr>
			<?php
			echo '</tr>';
		}
	}
}
?>